import requests
import json

while True:
    kw = input('请输入需要翻译的英文单词：')
    url = 'https://fanyi.baidu.com/sug'
    headers = {
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
                      'Chrome/85.0.4183.121 Safari/537.36 '
    }
    params = {
        kw: kw
    }

    r = requests.post(url=url, params=params, headers=headers)
    r.encoding = 'utf-8'
    data = r.json()
    print(data)
